--dofile"lua-l.lua"

--[[
function debug_tt(tab)
	local out = {}
	table.insert(out, "<pre>")
	for k, v in next, tab do
		table.insert(out, "["..k.."]="..v)

	end
	table.insert(out, "</pre>")
	return (table.concat(out))
	
end


local res, err = db.execute(io.open("search.sql", "r"):read("*a"), {lim=100, q1="hi", q2="lua"})
if err then
	print(err)
	return
end

local t = {}

local out = {}

while res:fetch(t, "a") do
	table.insert(out, debug_tt(t))
end

]]

function test(str)

print(str:match("<([^<]+)>.*"))

end

test([[<19981207092038.A22020@pdi.com> from "Chris Trimble" at Dec 7, 98 03:29:45 pm]])
test([[ <199812071635.OAA15793@gauguin.tecgraf.puc-rio.br>                                                                                   ]])
test([[ <199812071635.OAA15793@gauguin.tecgraf.puc-rio.br>; from Luiz Henrique de Figueiredo on Mon, Dec 07, 1998 at 02:36:34PM -0200        ]])
test([[ <19981207153734.T27696@home.chat.net>; from David Jeske on Mon, Dec 07, 1998 at 09:35:13PM -0200                                     ]])
test([[ Your message of "Mon, 07 Dec 1998 22:32:21 -0200."              <19981207163526.A8321@home.chat.net>                                 ]])
test([[ <199812081124.JAA17025@gauguin.tecgraf.puc-rio.br>; from Luiz Henrique de Figueiredo on Tue, Dec 08, 1998 at 09:25:36AM -0200        ]])
test([[ <199812081729.PAA03585@obatala.inf.puc-rio.br>; from Roberto Ierusalimschy on Tue, Dec 08, 1998 at 03:30:07PM -0200                  ]])
test([[ <199812082035.SAA22804@gris.tecgraf.puc-rio.br>; from Luiz Henrique de Figueiredo on Tue, Dec 08, 1998 at 06:36:27PM -0200           ]])
test([[ <199812082348.VAA17642@gauguin.tecgraf.puc-rio.br>; from Luiz Henrique de Figueiredo on Tue, Dec 08, 1998 at 09:49:14PM -0200        ]])
test([[ <199810142204.UAA08426@obatala.inf.puc-rio.br> (message from  Roberto Ierusalimschy on Wed, 14 Oct 1998 20:05:23 -0200)              ]])
test([[ <v01530500b2970b69cef4@[130.67.68.60]>; from Jon Kleiser on Fri, Dec 11, 1998 at 04:46:09PM -0200                   ]])


